package cn.edu.zafu.bigdata.x.zhaobolei.Fifth;

class InvalidScoreException extends Exception {
    public InvalidScoreException(String message) {
        super(message);
    }
}

public class ScoreChecker {
    public static void checkScore(int score) throws InvalidScoreException {
        if (score < 0 || score > 100) {
            throw new InvalidScoreException("输入的分数无效，分数应在 0 到 100 之间。");
        } else {
            System.out.println("分数有效！");
        }
    }


    public static void main(String[] args) {
        try {
            checkScore(12);
            checkScore(122);
        } catch (InvalidScoreException e) {
            System.out.println("Error: " + e.getMessage());
        }
    }
}